package org.jeecg.modules.lab.items.temp.service.impl;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.lab.entrust.entity.LabItemsRecordPerson;
import org.jeecg.modules.lab.items.temp.entity.LabItemsTempPerson;
import org.jeecg.modules.lab.items.temp.mapper.LabItemsTempPersonMapper;
import org.jeecg.modules.lab.items.temp.service.ILabItemsTempPersonService;
import org.jeecg.modules.lab.items.vo.LabRecordPer;
import org.jeecg.modules.lab.items.vo.LabTempPer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Description: 实验项目模板_人员信息
 * @Author: jeecg-boot
 * @Date:   2023-10-08
 * @Version: V1.0
 */
@Service
public class LabItemsTempPersonServiceImpl extends ServiceImpl<LabItemsTempPersonMapper, LabItemsTempPerson> implements ILabItemsTempPersonService {

    @Autowired
    private LabItemsTempPersonMapper labItemsTempPersonMapper;

    @Override
    public List<LabTempPer> handTempData(String itemId) {
        List<LabTempPer> tempPerList = labItemsTempPersonMapper.getTempPerList(itemId);
        QueryWrapper<LabItemsTempPerson> queryWrapper = new QueryWrapper<>();
        for (LabTempPer labTempPer : tempPerList) {
            queryWrapper.clear();
            queryWrapper.eq("field_row", labTempPer.getPId())
                    .eq("item_id", itemId)
                    .orderByAsc("field_sort");
            List<LabItemsTempPerson> itemsTempPersonList = labItemsTempPersonMapper.selectList(queryWrapper);
            labTempPer.setLabItemsTempPersonList(itemsTempPersonList);
        }
        return tempPerList;
    }
}
